package com.maltys.dp.sequence;

/**
 * @author malty
 * @link <a href="https://leetcode.cn/problems/longest-continuous-increasing-subsequence/description/">最⻓递增⼦序列</a>
 */
public class LongestContinuesIncreasingSubsequence {
    public static void main(String[] args) {
        LongestContinuesIncreasingSubsequence lis = new LongestContinuesIncreasingSubsequence();
        int lengthOfLIS = lis.findLengthOfLCIS(new int[]{1,3,5,4,7});
        System.out.println(lengthOfLIS);
    }

    public int findLengthOfLCIS(int[] nums) {
        int[] dp = new int[nums.length];
        dp[0] = 1;
        int max = 1;
        for (int i = 1; i < nums.length; i++) {
            dp[i] = 1;
            if (nums[i] > nums[i - 1]) {
                dp[i] = Math.max(dp[i], dp[i - 1] + 1);
                max = Math.max(max, dp[i]);
            }
        }
        return max;
    }
}
